$(function () {
    vm.title = "静态资源国际化"
});

var vm = new Vue({
    el: '#rrapp',
    data: {
        title: null,
        showList: false,
        subPathList: [
            {
                value: null,
                label: "子路径"
            }
        ],
        messageCodeGenerator: {languageTypeList: [], subPaths: []},
        languageTypeList: [
            {"value": "zh_CN", "label": "zh_CN"},
            {"value": "zh_HK", "label": "zh_HK"},
            {"value": "en_US", "label": "en_US"}
        ],
        typeList: [
            {"value": "JAVA_STATIC", "label": "java静态资源"},
            {"value": "VUE", "label": "VUE"}
        ],
        translateTypeList: [
            {"value" : "DEFAULT", "label" : "默认(中文，其他不翻译)"},
            {"value" : "YeeCloudMt", "label" : "收费(较便宜)"},
            {"value" : "ErAi", "label" : "收费(较贵)"},
        ]
    },
    methods: {
        save: function (event) {
            var url = "code/generator/message";
            $.ajax({
                type: "POST",
                url: baseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.messageCodeGenerator),
                success: function (r) {
                    if (r.code === 0) {
                        alert('操作成功', function (index) {
                            // vm.reload();
                        });
                    } else {
                        alert(r.msg);
                    }
                }
            });
        },
        addSubPath: function () {
            vm.subPathList.push({value: null, label: ""})
        },
        deleteSubPath: function (index) {
            if (index == 0) {
                alert("第一个子路径不能删除");
                return;
            }
            vm.subPathList.splice(index, 1);
        }
    }
});